package com.yantong.mapper;

import com.yantong.utils.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.List;
import java.util.Map;

/**
 * 用户mapper
 * @author kanghaixin
 */
@Mapper
public interface UserMapper {
	/**
	 * user
	 * @param user
	 * @return
     */
	int insert(SysUser user);

	/**
	 * 主键获取user
	 * @param userId
     * @return
     */
	SysUser getByKey(Long userId);

	/**
	 * 条件查询.不分页
	 * @param map
	 * @return
     */
	List<SysUser> getListByParams(Map<String, Object> map);

	/**
	 * 分页
	 * @param map
	 * @param rowBounds
     * @return
     */
	List<SysUser> getListByParams(Map<String, Object> map, RowBounds rowBounds);

	/**
	 * 按条件统计
	 * @param map
	 * @return
     */
	int countByParams(Map<String, Object> map);
	/**
	 * 更新用户信息
	 * @param user
	 * @return
     */
	int updateUser(SysUser user);

	/**
	 * 逻辑删除用户信息
	 * @param userId
	 * @return
     */
	int removeUser(Map<String, Object> map);

	/**
	 * 批量删除用户信息
	 * @param userIds
	 * @return
     */
	int batchRemoveUser(List<Long> userIds);

    List<SysUser> getByName(String name);

	SysUser getUserByName(@Param("name") String name);

}
